<script  lang="ts" setup>
import { ref } from "vue";
import List from "../../../components/list.vue";

defineProps(["userInfoJson"]);

// interface UserData {
//   idCard: number;
//   sex: number;
//   age: number;
//   mobile: number;
//   address: string;
//   infoFrom: string;
//   bingType: Array;
// }
// const userInfo = ref<UserData>({});
const colorList = ref([
  {
    bgColor: "#ECFEF8",
    color: "#45BBB0",
  },
  {
    bgColor: "#FCF2E7",
    color: "#F7971C",
  },
  {
    bgColor: "#71A2ED",
    color: "#E9ECFB",
  },
]);

// userInfo.value = props.userInfoJson;
</script>

<template>
  <div class="titWrap">
    <span class="personTitle">个人信息</span>
  </div>
  <div class="userWrap">
    <List label="身份证号" :value="$props?.userInfoJson?.idCard" />
    <List label="性别" :value="$props?.userInfoJson.sex" />
    <List label="年龄" :value="$props?.userInfoJson.age" />
    <List label="联系电话" :value="$props?.userInfoJson?.mobile" />
    <List label="现居地" :value="$props?.userInfoJson?.address" />
    <List label="居民来源" :value="$props?.userInfoJson?.infoFrom" />
    <List label="病例">
      <span
        :style="{
          backgroundColor: colorList[i].bgColor,
          color:colorList[i].color,
          borderColor:colorList[i].color
        }"
        class="tagText"
        v-for="(x,i) in $props?.userInfoJson?.bingType"
        :key="i"
      >{{ x.name }}</span>
    </List>>
  </div>
</template>

<style scoped lang="scss">
.userWrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: white;
  margin: 0 12px;
  border-radius: 8px;
}

.titWrap {
  margin: 18px 0 12px 12px;
}

.personTitle {
  color: #111;
}

.tagText {
  font-size: 12px;
  padding: 2px 6px;
  background-color: red;
  border: 1px solid blue;
  border-radius: 4px;
  margin-right: 6px;
}
</style>


